var OnlineStoreApiModule = { make_api_post_request_processing_data: function (operation, data, callback_success, callback_error, data_type, before_send, callback_complete, extra) { var url = '/' + LANG_CODE + '/' + ONLINE_STORE_API_URL_SEGMENT + '/'; if (typeof data === "undefined") { data = {}; } data[ONLINE_STORE_API_OPERATION_KEY] = operation; if (typeof extra === "undefined") { extra = {}; } if (typeof before_send !== "function") { before_send = function () { return true; } } if (typeof callback_success !== "function") { callback_success = function () { return true; } } if (typeof callback_error !== "function") { callback_error = function () { return true; } } if (typeof callback_complete !== "function") { callback_complete = function () { return true; } } if (typeof data_type === 'undefined') { data_type = 'json'; } var ajax_parameters = { type: 'POST', url: url, async: true, data: data, dataType: data_type, before_send: before_send, success: function (response) { callback_success(response); }, error: function (response) { callback_error(response); }, complete: function () { callback_complete(); } }; for (var property in extra) { ajax_parameters[property] = extra; } $.ajax(ajax_parameters); }, };